package com.sxt.springboot.config;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerInterceptor;

public class LoginInterceptor implements HandlerInterceptor{
	
	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
			throws Exception {
	Object object=request.getSession().getAttribute("user");
	if(null!=object) {
		return true;
	}else {
		response.sendRedirect("../index.jsp");
		return false;
	}
	}
}
